/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package aybolit.core.objects;

import aybolit.core.objects.dao.AnalyzysNameDao;
import aybolit.core.objects.dao.HealthAnalysysDao;
import aybolit.core.objects.dao.HealthingDao;
import aybolit.core.objects.model.AnalyzesName;
import aybolit.core.objects.model.HealingAnalyzes;
import java.io.Serializable;
import java.util.*;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;

/**
 *
 * @author Masumov Emin
 */
public class HealthingAnalysys implements Serializable {

    AnalyzysNameDao analysysName;
    HealthAnalysysDao healthAnalysysDao;
    private List<HealingAnalyzes> health;
    private Map<String, String> analyzesNameMap = new HashMap<String, String>();
    private String analyzesNameID;
    private Date data;
    private HealingAnalyzes analyzess;
    HealthingDao healthingDaoImp;
    private String value;
    public List<HealingAnalyzes> healthingAnalysysByPacientId() {
        HttpSession ses = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(true);
        String id = (String) ses.getAttribute("pacientID");
        System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!! pacient ID" + id);
        health=healthAnalysysDao.findHealingAnalyzesByPacientId(id);
        return health; 
    }

    public Map<String, String> getAnalyzes() {


        List<AnalyzesName> list = analysysName.findAllAnalyzesName();
        for (Iterator iter = list.iterator(); iter.hasNext();) {
            AnalyzesName analyzes = (AnalyzesName) iter.next();
            analyzesNameMap.put(analyzes.getName(), String.valueOf(analyzes.getAnalyzesNameId()));
        }
        return analyzesNameMap;
    }

    public void save(String id,String value) {
        System.out.println("H analyzys id="+id+"   value="+value);
        HealingAnalyzes hel=healthAnalysysDao.findHealingAnalyzById(id);
        hel.setValue(value);
        healthAnalysysDao.saveOrUpdateHealingAnalyz(hel);
    }

    public HealthAnalysysDao getHealthAnalysysDao() {
        return healthAnalysysDao;
    }

    public void setHealthAnalysysDao(HealthAnalysysDao healthAnalysysDao) {
        this.healthAnalysysDao = healthAnalysysDao;
    }

    public List<HealingAnalyzes> getHealth() {
        return health;
    }

    public void setHealth(List<HealingAnalyzes> health) {
        this.health = health;
    }

    public AnalyzysNameDao getAnalysysName() {
        return analysysName;
    }

    public void setAnalysysName(AnalyzysNameDao analysysName) {
        this.analysysName = analysysName;
    }

    public Map<String, String> getAnalyzesNameMap() {
        return analyzesNameMap;
    }

    public void setAnalyzesNameMap(Map<String, String> analyzesNameMap) {
        this.analyzesNameMap = analyzesNameMap;
    }

    public String getAnalyzesNameID() {
        return analyzesNameID;
    }

    public void setAnalyzesNameID(String analyzesNameID) {
        this.analyzesNameID = analyzesNameID;
    }

    public Date getData() {
        return data;
    }

    public void setData(Date data) {
        this.data = data;
    }

    public HealthingDao getHealthingDaoImp() {
        return healthingDaoImp;
    }

    public void setHealthingDaoImp(HealthingDao healthingDaoImp) {
        this.healthingDaoImp = healthingDaoImp;
    }

    public HealingAnalyzes getAnalyzess() {
        return analyzess;
    }

    public void setAnalyzess(HealingAnalyzes analyzess) {
        this.analyzess = analyzess;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
    
    
}
